package com.wenjunwu.blog.service.impl;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.wenjunwu.blog.dao.SystemRoleDao;
import com.wenjunwu.blog.entity.SystemRole;
import com.wenjunwu.blog.service.SystemRoleService;

@Service
public class SystemRoleServiceImpl implements SystemRoleService {

	@Autowired
	private SystemRoleDao systemRoleDao;

	@Override
	public Page<SystemRole> getAllRoles(int pageNum, int pageSize, Map<String, Object> params) {
		return PageHelper.startPage(pageNum, pageSize).doSelectPage(() -> systemRoleDao.selectAllRoles());
	}

	@Override
	public boolean freezeUnFreeze(SystemRole record) {
		if (systemRoleDao.updateByPrimaryKeySelective(record) > 0) {
			return true;
		}
		return false;
	}

}
